package lex.mtd.utils.prefs;

import org.lex.app.prefs.MemoryResourceMap;
import org.lex.app.prefs.ResourceHelper;
import org.lex.app.prefs.ResourceMap;
import org.lex.utils.SystemProperties;

public class Keys {
	public static final String DOWNLOAD_DIRECTORY = "download.directory";
	public static final String MINIMAL_DATA_BLOCK = "download.minDataBlock";
	public static final String MINIMAL_TIME_BLOCK = "download.minTimeBlock";
	public static final String THREAD_LIMIT = "download.threadLimite";
	public static final String UI_REFRESH_DELAY = "ui.refreshDelay";
	// =========================================================
	private static ResourceMap defaults = null;

	public static void loadDefaultConfiguration(ResourceMap rm) {
		ResourceHelper.addAll(getDefaultConfiguration(), rm);
	}

	public static ResourceMap getDefaultConfiguration() {
		if (null == defaults) {
			defaults = new MemoryResourceMap();
			defaults.putProperty(Keys.DOWNLOAD_DIRECTORY, SystemProperties.userHome());
			defaults.putProperty(Keys.MINIMAL_DATA_BLOCK, "20");
			defaults.putProperty(Keys.MINIMAL_TIME_BLOCK, "2");
			defaults.putProperty(Keys.THREAD_LIMIT, "5");
			defaults.putProperty(UI_REFRESH_DELAY, "500");
		}
		return defaults;
	}
}
